package com.learn.sixday;

import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Lists;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ln
 * @Description: ${todo}
 * @date 2020/12/14
 */
public class Downlaoder {
    public static List<String> download() throws Exception {
        URLConnection connection = new URL("https:www.baidu.com/").openConnection();
        ArrayList<String> list = Lists.newArrayList();
        try(BufferedReader reader=
                    new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8)
        )) {
            String line;
            while ((line=reader.readLine())!=null){
               list.add(line);
            }
        }
        return list;

    }
}
